let mysql=require("mysql");
let connection=mysql.createConnection(
    {
        host:"127.0.0.1",
        user:"root",
        password:"root",
        database:"homework"

    }
);
connection.connect();
function usePromise(sql){
    return new Promise((resvole,reject)=>{
        connection.query(sql,(err,data)=>{
            if(err==null){
                resvole(data);
            }else{
                reject(err);
            }
        })
    })
};
async function UseAsync(sql){
    let data=await usePromise(sql);
    console.log(data);
}
UseAsync("select * from user");
connection.end();